package com.yaoli.ajob;

import java.util.ArrayList;
import java.util.Scanner;

/**
 * Created by will on 2017/7/27.
 */
public class _645_SetMismatch {
    public int[] findErrorNums(int[] nums) {
        int p [] = new int[nums.length];

        for(int i = 0 ; i < nums.length ; i++){
            p[nums[i] - 1] = p[nums[i] - 1] + 1;
        }

        ArrayList<Integer> list = new ArrayList<Integer>();
        ArrayList<Integer> list2 = new ArrayList<Integer>();

        for(int i = 0 ; i < p.length ; i++){
            if(p[i] == 2){
                list2.add(i + 1);
            }
            if(p[i] == 0){
                list.add(i + 1);
            }
        }

        int res [] = new int[list.size() + list2.size()];

        for(int i = 0 ; i < list2.size() ; i++){
            res[i] = list2.get(i);
        }
        for(int i = list2.size() , j = 0 ; j < list.size() ; j++,i++){
            res[i] = list.get(j);
        }
        return res;
    }

    public static void main(String[] args) {
//        Scanner input = new Scanner(System.in);
        String line = " adf  dfd";//input.nextLine();

        String [] ss = line.split(" ");

        System.out.println();
    }
}
